package com.lanxin.oa.message.controller;

import com.lanxin.bean.XxDuanxiaoxi;
import com.lanxin.bean.XxXiaoxijieshou;
import com.lanxin.bean.ZzAccount;
import com.lanxin.oa.message.service.DuanxiaoxiService;
import com.lanxin.util.PageBean;
import com.lanxin.util.TimeConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;
import java.util.Date;

@Controller
@RequestMapping("dxxdate")
public class DuanxiaoxiDateController extends TimeConverter {

    @Autowired
    private DuanxiaoxiService duanxiaoxiService;

    //根据条件查询短消息
    @RequestMapping("pageDuanxiaoxi")
    public ModelAndView pageDuanxiaoxi(Integer page, Integer pageSize, HttpSession session, String biaoti,
                                       Integer jieshouren, Date startDate, Date endDate){
        ZzAccount account = (ZzAccount) session.getAttribute("account");
        PageBean<XxDuanxiaoxi> duanxiaoxiList = duanxiaoxiService.pageDaunxiaoxi(page,pageSize,account.getEmployee().getOid(),
                biaoti,jieshouren,startDate,endDate);
        ModelAndView mv = new ModelAndView();
        mv.addObject("duanxiaoxiList",duanxiaoxiList);
        mv.setViewName("view/xx/listDuanxiaoxi");
        return mv;
    }

    //根据条件查询短消息
    @RequestMapping("pagexxjs")
    public ModelAndView pagexxjs(Integer page, Integer pageSize, String biaoti,
                                       Integer jieshouren, Date startDate, Date endDate,HttpSession session){
        ZzAccount account = (ZzAccount) session.getAttribute("account");
        PageBean<XxXiaoxijieshou> xxjsPage = duanxiaoxiService.pageXxjs(page,pageSize,biaoti,jieshouren,startDate,
                endDate,account.getEmployee().getOid());
        ModelAndView mv = new ModelAndView();
        mv.addObject("xxjsPage",xxjsPage);
        mv.setViewName("view/xx/xiaoxijieshou");
        return mv;
    }

}